<?php

defined('SYSPATH') or die('Access error!');

class Model_Menu extends Model
{

    /**
     * 后台需要的广告列表分页
     * @param type $where_arr
     * @return type
     */
    public function get_menu_list($where_arr = '', $nums = 10)
    {
        $where_sql = '';
        if (Arr::validate_arr($where_arr))
        {
            $where_sql = $this->get_where($where_arr);
        }

        $where_sql .= ' ORDER BY  position,type DESC, id DESC';

        $sql = ' SELECT id,name, url, position, type ' .
                " FROM " . $this->table . $where_sql;
        $data = $this->get_page_list($sql, $nums);
        return count($data) > 0 ? $data : array();
    }

    public function get_menu_detail($id)
    {
        return $this->get_row(array('id'=>$id));
    }

}